package com.cjm.one.coupon.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.cjm.one.coupon.mapper.CustomerCouponMapper;
import com.cjm.one.coupon.service.CustomerCouponService;
import com.cjm.one.model.coupon.entity.CustomerCoupon;
import com.cjm.one.model.coupon.vo.CouponInfoVo;
import jakarta.annotation.Resource;
import org.checkerframework.checker.units.qual.C;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 29289
* @description 针对表【customer_coupon(乘客优惠券关联表)】的数据库操作Service实现
* @createDate 2024-09-05 15:59:26
*/
@Service
public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper, CustomerCoupon>
    implements CustomerCouponService {
    @Resource
    private CustomerCouponMapper customerCouponMapper;

    @Override
    public Page<CustomerCoupon> listPage(Integer current, Integer size, String keyword, Integer status,Long userId) {
        return customerCouponMapper.listPage(new Page<CustomerCoupon>(current,size),keyword,status,userId);
    }

    @Override
    public Boolean receiveCoupon(CustomerCoupon customerCoupon) {
        int insert = customerCouponMapper.insert(customerCoupon);
        return insert > 0;
    }

    @Override
    public Page<CouponInfoVo> getCouponInfoAppReceivedPage(Long current, Long size,String keyWord, Integer rangeType, Long customerId) {
        Page<CouponInfoVo> page = new Page<>(current, size);
        Page<CouponInfoVo> Vopage = customerCouponMapper.selectCouponInfoAppReceivedPage(page,keyWord, rangeType, customerId);

        return Vopage;
    }
}




